/*
 * ModBasicUartBridge.c
 *
 * Created: 23/03/2012 16:53:02
 *  Author: marionse
 */ 

#include "ModBasicUartBridge.h"
#include "ModRF.h"
#include "ModUart.h"


/**
* \brief FONCTION PRIVEE DU MODULE
*/



/**
* \brief fonction d'initialisation du module
*/
ERetCode ModBasicUartBridgeInit( void )
{
	ERetCode lo_ret_code = E_RET_SUCCESS;

	lo_ret_code = ModUartInit();
	
	return lo_ret_code;
}

/**
* \brief fonction appelee a chaque passage dans la boucle main
*/
ERetCode ModBasicUartBridgeTick( void )
{
	ERetCode lo_ret_code = E_RET_SUCCESS;
	
	TRFMsg l_in_rf_msg;
	TUartMsg l_in_uart_msg;
	
	ModUartTick();
	
	if( E_RET_SUCCESS == modRFGetMsg( &l_in_rf_msg ) )
	{
		modUartSendMsg( &l_in_rf_msg );
	}
	
	if( E_RET_SUCCESS == modUartGetMsg( &l_in_uart_msg ) )
	{
		modRFSendMsg( &(l_in_uart_msg.msg), l_in_uart_msg.dest_addr );
	}

	return lo_ret_code;
}
